<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from '../components/HelloWorld.vue'
import { useCounterStore } from '@/stores/counter';
const store=useCounterStore();
</script>

<template>

  <div class="layout">
    <el-container class="app-shell">
      <el-header height="64px" class="app-header">
        <div class="header-left">溯源管理系统</div>
        <div class="header-right">
          <el-tag type="danger">当前用户名：{{ store.currentuser.userName }},当前昵称：{{ store.currentuser.userNickname }},角色：{{ store.currentuser.roleName }}</el-tag>
        </div>
      </el-header>
      <el-container class="app-body">
        <el-aside width="200px" class="app-aside">
          <el-scrollbar>
            <el-menu
              router
              :default-active="$route.path"
              :default-openeds="['1']"
              :unique-opened="true"
              active-text-color="#ffd04b"
              background-color="#1f2937"
              text-color="#cbd5e1"
              class="side-menu"
            >
              <el-sub-menu index="1">
                <template #title>
                  <el-icon><location /></el-icon>
                  <span>菜单</span>
                </template>
                <el-menu-item index="/BasicInformation">溯源管理</el-menu-item>
                <!--  <el-menu-item index="1-2">item two</el-menu-item> -->
                <el-menu-item index="/">退出登录</el-menu-item>
              </el-sub-menu>
            </el-menu>
          </el-scrollbar>
        </el-aside>
        <el-main class="app-main">
          <div class="content-container">
            <RouterView />
          </div>
        </el-main>
      </el-container>
    </el-container>
  </div>
<!-- 
  <header>
    <img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />

    <div class="wrapper">
      <HelloWorld msg="You did it!" />

      <nav>
        <RouterLink to="/">Home</RouterLink>
        <RouterLink to="/about">About</RouterLink>
          <RouterLink to="/BasicInformation">溯源管理-基本信息</RouterLink>
      </nav>
    </div>
  </header> -->

</template>

<style scoped>
header {
  line-height: 1.5;
  max-height: 100vh;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

nav {
  width: 100%;
  font-size: 12px;
  text-align: center;
  margin-top: 2rem;
}

nav a.router-link-exact-active {
  color: var(--color-text);
}

nav a.router-link-exact-active:hover {
  background-color: transparent;
}

nav a {
  display: inline-block;
  padding: 0 1rem;
  border-left: 1px solid var(--color-border);
}

nav a:first-of-type {
  border: 0;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }

  nav {
    text-align: left;
    margin-left: -1rem;
    font-size: 1rem;

    padding: 1rem 0;
    margin-top: 1rem;
  }
}

/* layout optimization */
.layout {
  min-height: 100vh;
}

.app-shell {
  height: 100vh;
  width: 1850px;
  border: 1px solid var(--el-border-color);
  box-sizing: border-box;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--el-border-color);
}

.app-body {
  height: calc(100vh - 64px);
}

.app-aside {
  background: #1f2937;
}

.side-menu {
  border-right: none;
  height: calc(100vh - 64px);
}

.app-main {
  padding: 16px 0;
  background: var(--el-fill-color-light);
  overflow: auto;
}

/* menu layout tuning */
.side-menu :deep(.el-sub-menu__title),
.side-menu :deep(.el-menu-item) {
  height: 44px;
  line-height: 44px;
  padding: 0 16px;
  font-size: 14px;
}

.side-menu :deep(.el-sub-menu__title .el-icon),
.side-menu :deep(.el-menu-item .el-icon) {
  margin-right: 8px;
}

.side-menu :deep(.el-menu-item.is-active) {
  background-color: rgba(255, 208, 75, 0.12);
  color: #ffd04b;
}

.side-menu :deep(.el-menu-item:hover),
.side-menu :deep(.el-sub-menu__title:hover) {
  background-color: rgba(255, 255, 255, 0.06);
}

.app-aside :deep(.el-scrollbar__bar.is-horizontal) {
  display: none;
}

.content-container {
  max-width: 2060px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

@media (min-width: 1600px) {
  .content-container {
    max-width: 4000px;
  }
}

@media (max-width: 1200px) {
  .content-container {
    max-width: 100%;
    padding: 0 12px;
  }
}

.content-container :deep(.el-table) {
  width: 100%;
}
</style>
